<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<title>消费审核</title>
<%@include file="../collect/meta.jsp"%>
<link rel="stylesheet" href="css/radius.css" type="text/css"></link>
<link rel="stylesheet" href="css/table.css" type="text/css"></link>
<link rel="stylesheet" href="css/btn-bottom.css" type="text/css"></link>
<script type="text/javascript" src="${ctx}/js/returnTop.js"></script>
</head>
<body lang="zh-cn">
	<div class="wrapper">
		<c:import url="/collect/top.jsp"></c:import>
		<div class="main-container" id="main-container">
			<div class="main-container-inner">
				<c:import url="/collect/left.jsp"></c:import>
				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<ul class="breadcrumb">
							<li><i class="icon-home home-icon"></i>消费审核</li>
							<li>审核设定</li>
						</ul>
						<!-- .breadcrumb -->
					</div>
					<div class="page-content">
						<div class="row">
							<div class="col-xs-12">
								<table id="table_bug_report"
									class="table table-striped table-bordered table-hover">
									<tr>
										<th>每日自动审核金额上限</th>
										<th>审核起始时间</th>
										<th>自动审核间隔时长（小时）</th>
										<th>操作</th>
									</tr>
									<tr>
										<td>${examineSetting.dailyMoneyLimit}</td>
										<td>${fn:substring(examineSetting.examineBegintime, 0,
											fn:indexOf(examineSetting.examineBegintime, '.0'))}</td>
										<td>${examineSetting.examineInterval}</td>
										<td>
											<c:choose>
												<c:when test="${examineSetting.examineStart == 0 }">
													<a id="startFlag" class="btn btn-xs btn-primary radius"
														href="logconsumeexamineaction!modifyExamineStart?examineSetting.id=${examineSetting.id }&examineSetting.examineStart=1">
														启动
													</a>
												</c:when>
												<c:when test="${examineSetting.examineStart == 1 }">
													<a id="endFlag" class="btn btn-xs btn-primary radius"
														href="logconsumeexamineaction!modifyExamineStart?examineSetting.id=${examineSetting.id }&examineSetting.examineStart=0">
														停止
													</a>
												</c:when>
											</c:choose>
											&nbsp;
											<a class="btn btn-xs btn-primary radius"
												href="logconsumeexamineaction!goToUpdateExamineSetting?examineSetting.id=${examineSetting.id }">
												修改
											</a>
											&nbsp;
											<a id="del" class="btn btn-xs btn-primary radius"
												href="logconsumeexamineaction!delExamineSetting?examineSetting.id=${examineSetting.id }">
												删除
											</a>
										</td>
									</tr>
								</table>
							</div>
							<!-- /.col -->
						</div>
						<!-- /.row -->
					</div>
					<!-- /.page-content -->
				</div>
				<!-- /.main-content -->
			</div>
			<!-- /.main-container-inner -->
			<a href="#" id="btn-scroll-up"
				class="btn-scroll-up btn btn-sm btn-inverse"
				style="position:fixed;bottom:0;"><i
				class="icon-double-angle-up icon-only bigger-110"></i> </a>
		</div>
		<!-- /.main-container -->
		<div class="push"></div>
	</div>
	<c:import url="/collect/down.jsp"></c:import>
	<!-- 删除弹出框（Modal） -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content radius">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">操作提示</h4>
				</div>
				<div class="modal-body">
					<p>确定删除此记录吗？</p>
				</div>
				<div class="modal-footer radius">
					<a id="confirm" class="btn btn-primary btn-sm radius">确定</a>
					<button type="button" class="btn btn-sm btn-default radius"
						data-dismiss="modal">取消</button>
				</div>
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal -->
	</div>
	<!-- 启动弹出框（Modal） -->
	<div class="modal fade" id="startModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content radius">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">操作提示</h4>
				</div>
				<div class="modal-body">
					<p>确定启动自动审核吗？</p>
				</div>
				<div class="modal-footer radius">
					<a id="confirm" class="btn btn-primary btn-sm radius">确定</a>
					<button type="button" class="btn btn-sm btn-default radius"
						data-dismiss="modal">取消</button>
				</div>
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal -->
	</div>
	<!-- 停止弹出框（Modal） -->
	<div class="modal fade" id="stopModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content radius">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">操作提示</h4>
				</div>
				<div class="modal-body">
					<p>确定停止自动审核吗？</p>
				</div>
				<div class="modal-footer radius">
					<a id="confirm" class="btn btn-primary btn-sm radius">确定</a>
					<button type="button" class="btn btn-sm btn-default radius"
						data-dismiss="modal">取消</button>
				</div>
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal -->
	</div>
</body>
<script type="text/javascript">
	$(document).ready(function() {
		$('.xiaofeishenhe > ul').show();
		$('.xiaofeishenhe > ul > li > a').eq(0).css("color", "red");
		
		//提示框中确定按钮绑定删除事件
		$("a#del").click(function() {
			var href = $(this).attr("href");
			$("#myModal").modal('show');
			$("a#confirm").attr("href", href);
			return false;
		});
		
		// 提示框中确定按钮绑定启动事件
		$("a#startFlag").click(function() {
			var href = $(this).attr("href");
			$.ajax({
				url : "logconsumeexamineaction!verifyExamineBegintime",
				type : "post",
				datatype : "json",
				success : function(data) {
					var d = $.parseJSON(data);
					if (d.temp == 'ok') {
						$("#startModal").modal('show');
						$("a#confirm").attr("href", href);
					}else {
						alert(d.temp);
					}
				},
				error : function(request) {
					alert("Connection error");
				}
			});
			
			return false;
		});
		
		// 提示框中确定按钮绑定停止事件
		$("a#endFlag").click(function() {
			var href = $(this).attr("href");
			$("#stopModal").modal('show');
			$("a#confirm").attr("href", href);
			return false;
		});
	});
</script>
</html>
